#!/usr/bin/env python

queue = []


def enQ():
    queue.append(input('Enter new string:').strip())


def deQ():
    if len(queue) == 0:
        print('Can not pop from empty queue!')
    else:
        print('Removed [', queue.pop(0), ']')


def viewQ():
    print(queue)


CMDS = {'e': enQ, 'd': deQ, 'v': viewQ}


def showmenu():
    pr = '''
(E)nqueue
(D)equeue
(V)iew
(Q)uit

Enter choice: '''
    while True:
        try:
            choice = input(pr).strip()[0].lower()
        except:
            choice = 'q'
        print('\nYou picked: [%s]' % choice)
        if choice not in 'devq':
            print('Invalid option, try again')
            continue
        if choice == 'q':
            break
        else:
            CMDS[choice]()


if __name__ == '__main__':
    showmenu()
